﻿using System.ComponentModel.DataAnnotations;
using System.Globalization;

namespace SelfService.HaiTai.Models
{
    public class PayValidate
    {
        /// <summary>
        /// 业务代码
        /// </summary>
        public string TranCode { get; set; } = "0036";
        
        /// <summary>
        /// 结算流水号
        /// </summary>
        public string Jslsh { get; set; }

        /// <summary>
        /// 在线支付流水号
        /// </summary>
        public string Paylsh { get; set; } = "";

        /// <summary>
        /// 外部订单号
        /// </summary>
        public string OrderId { get; set; } = Guid.NewGuid().ToString("N");

        /// <summary>
        /// 支付时间
        /// </summary>
        public string Paydate { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

        /// <summary>
        /// 总费用
        /// </summary>
        public string Totalfee
        {
            get
            {
                var total = decimal.Parse(ZGYB) + decimal.Parse(JMYB) + decimal.Parse(CZK) + decimal.Parse(XJ) +
                            decimal.Parse(ZFB) + decimal.Parse(WX);
                return total.ToString(CultureInfo.InvariantCulture);
            }
        }

        /// <summary>
        /// 职工医保金额
        /// </summary>
        public string ZGYB { get; set; } = "0";
        /// <summary>
        /// 居民医保金额
        /// </summary>
        public string JMYB { get; set; } = "0";
        /// <summary>
        /// 储值卡金额
        /// </summary>
        public string CZK { get; set; } = "0";
        /// <summary>
        /// 现金
        /// </summary>
        public string XJ { get; set; } = "0";
        /// <summary>
        /// 支付宝
        /// </summary>
        public string ZFB { get; set; } = "0";
        /// <summary>
        /// 微信
        /// </summary>
        public string WX { get; set; } = "0";

        /// <summary>
        /// 支付类型: 0=自费, 1=居民, 2=职工
        /// </summary>
        public string MiType { get; set; } = "0";

        /// <summary>
        /// 社保原始数据
        /// </summary>
        public dynamic Mi { get; set; }

        /// <summary>
        /// 社保交易流水号
        /// </summary>
        public string Milsh { get; set; } = "";

        /// <summary>
        /// 参保人员类别
        /// </summary>
        public string PatientType { get; set; } = "";

        /// <summary>
        /// 医保卡号
        /// </summary>
        public string YBKXX { get; set; } = "";

        /// <summary>
        /// 社保个人编号
        /// </summary>
        public string GRBH { get; set; } = "";

        /// <summary>
        /// 统筹区域
        /// </summary>
        public string AreaId { get; set; } = "";

        /// <summary>
        /// 操作员ID
        /// </summary>
        public string UserId { get; set; }

        /// <summary>
        /// MAC地址
        /// </summary>
        public string MacAddress { get; set; }
        
        /// <summary>
        /// 周期号
        /// </summary>
        public string PeriodNum { get; set; }
    }
}
